Imports System
Imports System.Data
Imports System.Data.Common
Imports System.Collections.Generic

Public Class EVEN_Pedidos
   Implements ICloneable

#Region " Campos "
   Private m_sucr_codigo As String
   Private m_pedv_numero As Integer
   Private m_tipo_tabdoc As String
   Private m_tipo_codmotanula As String
   Private m_tipo_tabmotanula As String
   Private m_tipo_coddoc As String
   Private m_tipo_codfpg As String
   Private m_tipo_tabfpg As String
   Private m_tipo_tabmoneda As String
   Private m_tipo_codmoneda As String
   Private m_vend_codigo As String
   Private m_pedv_tipocambio As Decimal
   Private m_pedv_fecemi As Date
   Private m_pedv_fecvcmto As Date
   Private m_pedv_pctjcomiven As Decimal
   Private m_pedv_estado As String
   Private m_pedv_observaciones As String
   Private m_pedv_valortotals As Decimal
   Private m_pedv_valortotald As Decimal
   Private m_pedv_valorvtatotals As Decimal
   Private m_pedv_valorvtatotald As Decimal
   Private m_pedv_precvtatotals As Decimal
   Private m_pedv_precvtatotald As Decimal
   Private m_pedv_fletetotals As Decimal
   Private m_pedv_fletetotald As Decimal
   Private m_pedv_dctototals As Decimal
   Private m_pedv_dctototald As Decimal
   Private m_pedv_imp1totals As Decimal
   Private m_pedv_imp1totald As Decimal
   Private m_pedv_imp2totals As Decimal
   Private m_pedv_imp2totald As Decimal
   Private m_pedv_imp3totals As Decimal
   Private m_pedv_imp3totald As Decimal
   Private m_pedv_imp4totals As Decimal
   Private m_pedv_imp4totald As Decimal
   Private m_pedv_porcimp1 As Decimal
   Private m_pedv_porcimp2 As Decimal
   Private m_pedv_porcimp3 As Decimal
   Private m_pedv_porcimp4 As Decimal
   Private m_pedv_numdoc As String
   Private m_pedv_seriedoc As String
   Private m_pedv_razonsoc As String
   Private m_pedv_ruc As String
   Private m_pedv_dir As String
   Private m_pedv_tel As String
   Private m_pedv_fax As String
   Private m_pedv_diasvigencia As Short
   Private m_pedv_horapedido As DateTime
   Private m_pedv_horasalreparto As Date
   Private m_pedv_horaentrega As DateTime
   Private m_pedv_salida As String
   Private m_pedv_llegada As String
   Private m_lprv_codigo As String
   Private m_pedv_contacto As Integer
   Private m_pedv_numref As Integer
   Private m_pedv_exonimp1 As Boolean
   Private m_dire_item As Short
   Private m_entc_codrepartidor As String
   Private m_tipe_codigo As String
   Private m_entc_codigo As String
   Private m_tipe_codrepartidor As String
   Private m_tipo_tabdocventa As String
   Private m_tipo_coddocventa As String
   Private m_tipo_tabdocentrega As String
   Private m_tipo_coddocentrega As String
   Private m_pedv_tipo As String
   Private m_pedv_entrega As String
   Private m_pedv_porcdcto As Decimal
   Private m_tipe_codtrans As String
   Private m_entc_codtrans As String
   Private m_vehi_placa As String
   Private m_pedv_pagoparcial As Decimal
   Private m_pvta_codigo As String
   Private m_rowguid As Guid
   Private m_pedv_usrcrea As String
   Private m_pedv_feccrea As Date
   Private m_pedv_usrmod As String
   Private m_pedv_fecmod As Date
   Private m_nuevo As Boolean
   Private m_modificado As Boolean
   Private m_eliminado As Boolean

   Private m_pedv_costototal As Decimal
   Private m_docv_numero As Integer
   Private m_tipo_codrgs As String

   Public Enum NSTipoItem
      Producto
      Servicio
      DescuentoRecargo
   End Enum
#End Region

#Region " Constructores "
   Public Sub New()
      m_listDetPedidos = New List(Of EVEN_DetPedidos)()
   End Sub

   Public Sub New(ByVal x_codigo As Integer)
      m_sucr_codigo = x_codigo.ToString()
      m_pedv_numero = x_codigo
      m_tipo_tabdoc = (x_codigo * DateTime.Now.Millisecond).ToString()
      m_tipo_coddoc = x_codigo.ToString()
      m_pedv_valortotals = x_codigo * DateTime.Now.Second
      m_pedv_valortotald = x_codigo * DateTime.Now.Millisecond * DateTime.Now.Second
   End Sub

#End Region

#Region " Propiedades "
   Public Property SUCR_Codigo() As String
      Get
         Return m_sucr_codigo
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_sucr_codigo) Then
            If Not m_sucr_codigo.Equals(value) Then
               m_sucr_codigo = value
               OnSUCR_CodigoChanged(m_sucr_codigo, EventArgs.Empty)
            End If
         Else
            m_sucr_codigo = value
            OnSUCR_CodigoChanged(m_sucr_codigo, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_Numero() As Integer
      Get
         Return m_pedv_numero
      End Get
      Set(ByVal value As Integer)
         If Not IsNothing(m_pedv_numero) Then
            If Not m_pedv_numero.Equals(value) Then
               m_pedv_numero = value
               OnPEDV_NumeroChanged(m_pedv_numero, EventArgs.Empty)
            End If
         Else
            m_pedv_numero = value
            OnPEDV_NumeroChanged(m_pedv_numero, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property TIPO_TabDoc() As String
      Get
         Return m_tipo_tabdoc
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_tipo_tabdoc) Then
            If Not m_tipo_tabdoc.Equals(value) Then
               m_tipo_tabdoc = value
               OnTIPO_TabDocChanged(m_tipo_tabdoc, EventArgs.Empty)
            End If
         Else
            m_tipo_tabdoc = value
            OnTIPO_TabDocChanged(m_tipo_tabdoc, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property TIPO_CodMotAnula() As String
      Get
         Return m_tipo_codmotanula
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_tipo_codmotanula) Then
            If Not m_tipo_codmotanula.Equals(value) Then
               m_tipo_codmotanula = value
               OnTIPO_CodMotAnulaChanged(m_tipo_codmotanula, EventArgs.Empty)
            End If
         Else
            m_tipo_codmotanula = value
            OnTIPO_CodMotAnulaChanged(m_tipo_codmotanula, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property TIPO_TabMotAnula() As String
      Get
         Return m_tipo_tabmotanula
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_tipo_tabmotanula) Then
            If Not m_tipo_tabmotanula.Equals(value) Then
               m_tipo_tabmotanula = value
               OnTIPO_TabMotAnulaChanged(m_tipo_tabmotanula, EventArgs.Empty)
            End If
         Else
            m_tipo_tabmotanula = value
            OnTIPO_TabMotAnulaChanged(m_tipo_tabmotanula, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property TIPO_CodDoc() As String
      Get
         Return m_tipo_coddoc
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_tipo_coddoc) Then
            If Not m_tipo_coddoc.Equals(value) Then
               m_tipo_coddoc = value
               OnTIPO_CodDocChanged(m_tipo_coddoc, EventArgs.Empty)
            End If
         Else
            m_tipo_coddoc = value
            OnTIPO_CodDocChanged(m_tipo_coddoc, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property TIPO_CodFPG() As String
      Get
         Return m_tipo_codfpg
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_tipo_codfpg) Then
            If Not m_tipo_codfpg.Equals(value) Then
               m_tipo_codfpg = value
               OnTIPO_CodFPGChanged(m_tipo_codfpg, EventArgs.Empty)
            End If
         Else
            m_tipo_codfpg = value
            OnTIPO_CodFPGChanged(m_tipo_codfpg, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property TIPO_TabFPG() As String
      Get
         Return m_tipo_tabfpg
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_tipo_tabfpg) Then
            If Not m_tipo_tabfpg.Equals(value) Then
               m_tipo_tabfpg = value
               OnTIPO_TabFPGChanged(m_tipo_tabfpg, EventArgs.Empty)
            End If
         Else
            m_tipo_tabfpg = value
            OnTIPO_TabFPGChanged(m_tipo_tabfpg, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property TIPO_TabMoneda() As String
      Get
         Return m_tipo_tabmoneda
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_tipo_tabmoneda) Then
            If Not m_tipo_tabmoneda.Equals(value) Then
               m_tipo_tabmoneda = value
               OnTIPO_TabMonedaChanged(m_tipo_tabmoneda, EventArgs.Empty)
            End If
         Else
            m_tipo_tabmoneda = value
            OnTIPO_TabMonedaChanged(m_tipo_tabmoneda, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property TIPO_CodMoneda() As String
      Get
         Return m_tipo_codmoneda
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_tipo_codmoneda) Then
            If Not m_tipo_codmoneda.Equals(value) Then
               m_tipo_codmoneda = value
               OnTIPO_CodMonedaChanged(m_tipo_codmoneda, EventArgs.Empty)
            End If
         Else
            m_tipo_codmoneda = value
            OnTIPO_CodMonedaChanged(m_tipo_codmoneda, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property VEND_Codigo() As String
      Get
         Return m_vend_codigo
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_vend_codigo) Then
            If Not m_vend_codigo.Equals(value) Then
               m_vend_codigo = value
               OnVEND_CodigoChanged(m_vend_codigo, EventArgs.Empty)
            End If
         Else
            m_vend_codigo = value
            OnVEND_CodigoChanged(m_vend_codigo, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_TipoCambio() As Decimal
      Get
         Return m_pedv_tipocambio
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_tipocambio) Then
            If Not m_pedv_tipocambio.Equals(value) Then
               m_pedv_tipocambio = value
               OnPEDV_TipoCambioChanged(m_pedv_tipocambio, EventArgs.Empty)
            End If
         Else
            m_pedv_tipocambio = value
            OnPEDV_TipoCambioChanged(m_pedv_tipocambio, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_FecEmi() As Date
      Get
         Return m_pedv_fecemi
      End Get
      Set(ByVal value As Date)
         If Not IsNothing(m_pedv_fecemi) Then
            If Not m_pedv_fecemi.Equals(value) Then
               m_pedv_fecemi = value
               OnPEDV_FecEmiChanged(m_pedv_fecemi, EventArgs.Empty)
            End If
         Else
            m_pedv_fecemi = value
            OnPEDV_FecEmiChanged(m_pedv_fecemi, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_FecVcmto() As Date
      Get
         Return m_pedv_fecvcmto
      End Get
      Set(ByVal value As Date)
         If Not IsNothing(m_pedv_fecvcmto) Then
            If Not m_pedv_fecvcmto.Equals(value) Then
               m_pedv_fecvcmto = value
               OnPEDV_FecVcmtoChanged(m_pedv_fecvcmto, EventArgs.Empty)
            End If
         Else
            m_pedv_fecvcmto = value
            OnPEDV_FecVcmtoChanged(m_pedv_fecvcmto, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_PctjComiVen() As Decimal
      Get
         Return m_pedv_pctjcomiven
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_pctjcomiven) Then
            If Not m_pedv_pctjcomiven.Equals(value) Then
               m_pedv_pctjcomiven = value
               OnPEDV_PctjComiVenChanged(m_pedv_pctjcomiven, EventArgs.Empty)
            End If
         Else
            m_pedv_pctjcomiven = value
            OnPEDV_PctjComiVenChanged(m_pedv_pctjcomiven, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_Estado() As String
      Get
         Return m_pedv_estado
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_pedv_estado) Then
            If Not m_pedv_estado.Equals(value) Then
               m_pedv_estado = value
               OnPEDV_EstadoChanged(m_pedv_estado, EventArgs.Empty)
            End If
         Else
            m_pedv_estado = value
            OnPEDV_EstadoChanged(m_pedv_estado, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_Observaciones() As String
      Get
         Return m_pedv_observaciones
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_pedv_observaciones) Then
            If Not m_pedv_observaciones.Equals(value) Then
               m_pedv_observaciones = value
               OnPEDV_ObservacionesChanged(m_pedv_observaciones, EventArgs.Empty)
            End If
         Else
            m_pedv_observaciones = value
            OnPEDV_ObservacionesChanged(m_pedv_observaciones, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_ValorVtaTotalS() As Decimal
      Get
         Return m_pedv_valortotals
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_valortotals) Then
            If Not m_pedv_valortotals.Equals(value) Then
               m_pedv_valortotals = value
               OnPEDV_ValorTotalSChanged(m_pedv_valortotals, EventArgs.Empty)
            End If
         Else
            m_pedv_valortotals = value
            OnPEDV_ValorTotalSChanged(m_pedv_valortotals, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_ValorTotalD() As Decimal
      Get
         Return m_pedv_valortotald
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_valortotald) Then
            If Not m_pedv_valortotald.Equals(value) Then
               m_pedv_valortotald = value
               OnPEDV_ValorTotalDChanged(m_pedv_valortotald, EventArgs.Empty)
            End If
         Else
            m_pedv_valortotald = value
            OnPEDV_ValorTotalDChanged(m_pedv_valortotald, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_ValorTotalS() As Decimal
      Get
         Return m_pedv_valorvtatotals
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_valorvtatotals) Then
            If Not m_pedv_valorvtatotals.Equals(value) Then
               m_pedv_valorvtatotals = value
               OnPEDV_ValorVtaTotalSChanged(m_pedv_valorvtatotals, EventArgs.Empty)
            End If
         Else
            m_pedv_valorvtatotals = value
            OnPEDV_ValorVtaTotalSChanged(m_pedv_valorvtatotals, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_ValorVtaTotalD() As Decimal
      Get
         Return m_pedv_valorvtatotald
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_valorvtatotald) Then
            If Not m_pedv_valorvtatotald.Equals(value) Then
               m_pedv_valorvtatotald = value
               OnPEDV_ValorVtaTotalDChanged(m_pedv_valorvtatotald, EventArgs.Empty)
            End If
         Else
            m_pedv_valorvtatotald = value
            OnPEDV_ValorVtaTotalDChanged(m_pedv_valorvtatotald, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_PrecVtaTotalS() As Decimal
      Get
         Return m_pedv_precvtatotals
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_precvtatotals) Then
            If Not m_pedv_precvtatotals.Equals(value) Then
               m_pedv_precvtatotals = value
               OnPEDV_PrecVtaTotalSChanged(m_pedv_precvtatotals, EventArgs.Empty)
            End If
         Else
            m_pedv_precvtatotals = value
            OnPEDV_PrecVtaTotalSChanged(m_pedv_precvtatotals, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_PrecVtaTotalD() As Decimal
      Get
         Return m_pedv_precvtatotald
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_precvtatotald) Then
            If Not m_pedv_precvtatotald.Equals(value) Then
               m_pedv_precvtatotald = value
               OnPEDV_PrecVtaTotalDChanged(m_pedv_precvtatotald, EventArgs.Empty)
            End If
         Else
            m_pedv_precvtatotald = value
            OnPEDV_PrecVtaTotalDChanged(m_pedv_precvtatotald, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_FleteTotalS() As Decimal
      Get
         Return m_pedv_fletetotals
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_fletetotals) Then
            If Not m_pedv_fletetotals.Equals(value) Then
               m_pedv_fletetotals = value
               OnPEDV_FleteTotalSChanged(m_pedv_fletetotals, EventArgs.Empty)
            End If
         Else
            m_pedv_fletetotals = value
            OnPEDV_FleteTotalSChanged(m_pedv_fletetotals, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_FleteTotalD() As Decimal
      Get
         Return m_pedv_fletetotald
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_fletetotald) Then
            If Not m_pedv_fletetotald.Equals(value) Then
               m_pedv_fletetotald = value
               OnPEDV_FleteTotalDChanged(m_pedv_fletetotald, EventArgs.Empty)
            End If
         Else
            m_pedv_fletetotald = value
            OnPEDV_FleteTotalDChanged(m_pedv_fletetotald, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_DctoTotalS() As Decimal
      Get
         Return m_pedv_dctototals
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_dctototals) Then
            If Not m_pedv_dctototals.Equals(value) Then
               m_pedv_dctototals = value
               OnPEDV_DctoTotalSChanged(m_pedv_dctototals, EventArgs.Empty)
            End If
         Else
            m_pedv_dctototals = value
            OnPEDV_DctoTotalSChanged(m_pedv_dctototals, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_DctoTotalD() As Decimal
      Get
         Return m_pedv_dctototald
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_dctototald) Then
            If Not m_pedv_dctototald.Equals(value) Then
               m_pedv_dctototald = value
               OnPEDV_DctoTotalDChanged(m_pedv_dctototald, EventArgs.Empty)
            End If
         Else
            m_pedv_dctototald = value
            OnPEDV_DctoTotalDChanged(m_pedv_dctototald, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_Imp1TotalS() As Decimal
      Get
         Return m_pedv_imp1totals
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_imp1totals) Then
            If Not m_pedv_imp1totals.Equals(value) Then
               m_pedv_imp1totals = value
               OnPEDV_Imp1TotalSChanged(m_pedv_imp1totals, EventArgs.Empty)
            End If
         Else
            m_pedv_imp1totals = value
            OnPEDV_Imp1TotalSChanged(m_pedv_imp1totals, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_Imp1TotalD() As Decimal
      Get
         Return m_pedv_imp1totald
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_imp1totald) Then
            If Not m_pedv_imp1totald.Equals(value) Then
               m_pedv_imp1totald = value
               OnPEDV_Imp1TotalDChanged(m_pedv_imp1totald, EventArgs.Empty)
            End If
         Else
            m_pedv_imp1totald = value
            OnPEDV_Imp1TotalDChanged(m_pedv_imp1totald, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_Imp2TotalS() As Decimal
      Get
         Return m_pedv_imp2totals
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_imp2totals) Then
            If Not m_pedv_imp2totals.Equals(value) Then
               m_pedv_imp2totals = value
               OnPEDV_Imp2TotalSChanged(m_pedv_imp2totals, EventArgs.Empty)
            End If
         Else
            m_pedv_imp2totals = value
            OnPEDV_Imp2TotalSChanged(m_pedv_imp2totals, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_Imp2TotalD() As Decimal
      Get
         Return m_pedv_imp2totald
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_imp2totald) Then
            If Not m_pedv_imp2totald.Equals(value) Then
               m_pedv_imp2totald = value
               OnPEDV_Imp2TotalDChanged(m_pedv_imp2totald, EventArgs.Empty)
            End If
         Else
            m_pedv_imp2totald = value
            OnPEDV_Imp2TotalDChanged(m_pedv_imp2totald, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_Imp3TotalS() As Decimal
      Get
         Return m_pedv_imp3totals
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_imp3totals) Then
            If Not m_pedv_imp3totals.Equals(value) Then
               m_pedv_imp3totals = value
               OnPEDV_Imp3TotalSChanged(m_pedv_imp3totals, EventArgs.Empty)
            End If
         Else
            m_pedv_imp3totals = value
            OnPEDV_Imp3TotalSChanged(m_pedv_imp3totals, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_Imp3TotalD() As Decimal
      Get
         Return m_pedv_imp3totald
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_imp3totald) Then
            If Not m_pedv_imp3totald.Equals(value) Then
               m_pedv_imp3totald = value
               OnPEDV_Imp3TotalDChanged(m_pedv_imp3totald, EventArgs.Empty)
            End If
         Else
            m_pedv_imp3totald = value
            OnPEDV_Imp3TotalDChanged(m_pedv_imp3totald, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_Imp4TotalS() As Decimal
      Get
         Return m_pedv_imp4totals
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_imp4totals) Then
            If Not m_pedv_imp4totals.Equals(value) Then
               m_pedv_imp4totals = value
               OnPEDV_Imp4TotalSChanged(m_pedv_imp4totals, EventArgs.Empty)
            End If
         Else
            m_pedv_imp4totals = value
            OnPEDV_Imp4TotalSChanged(m_pedv_imp4totals, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_Imp4TotalD() As Decimal
      Get
         Return m_pedv_imp4totald
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_imp4totald) Then
            If Not m_pedv_imp4totald.Equals(value) Then
               m_pedv_imp4totald = value
               OnPEDV_Imp4TotalDChanged(m_pedv_imp4totald, EventArgs.Empty)
            End If
         Else
            m_pedv_imp4totald = value
            OnPEDV_Imp4TotalDChanged(m_pedv_imp4totald, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_PorcImp1() As Decimal
      Get
         Return m_pedv_porcimp1
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_porcimp1) Then
            If Not m_pedv_porcimp1.Equals(value) Then
               m_pedv_porcimp1 = value
               OnPEDV_PorcImp1Changed(m_pedv_porcimp1, EventArgs.Empty)
            End If
         Else
            m_pedv_porcimp1 = value
            OnPEDV_PorcImp1Changed(m_pedv_porcimp1, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_PorcImp2() As Decimal
      Get
         Return m_pedv_porcimp2
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_porcimp2) Then
            If Not m_pedv_porcimp2.Equals(value) Then
               m_pedv_porcimp2 = value
               OnPEDV_PorcImp2Changed(m_pedv_porcimp2, EventArgs.Empty)
            End If
         Else
            m_pedv_porcimp2 = value
            OnPEDV_PorcImp2Changed(m_pedv_porcimp2, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_PorcImp3() As Decimal
      Get
         Return m_pedv_porcimp3
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_porcimp3) Then
            If Not m_pedv_porcimp3.Equals(value) Then
               m_pedv_porcimp3 = value
               OnPEDV_PorcImp3Changed(m_pedv_porcimp3, EventArgs.Empty)
            End If
         Else
            m_pedv_porcimp3 = value
            OnPEDV_PorcImp3Changed(m_pedv_porcimp3, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_PorcImp4() As Decimal
      Get
         Return m_pedv_porcimp4
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_porcimp4) Then
            If Not m_pedv_porcimp4.Equals(value) Then
               m_pedv_porcimp4 = value
               OnPEDV_PorcImp4Changed(m_pedv_porcimp4, EventArgs.Empty)
            End If
         Else
            m_pedv_porcimp4 = value
            OnPEDV_PorcImp4Changed(m_pedv_porcimp4, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_NumDoc() As String
      Get
         Return m_pedv_numdoc
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_pedv_numdoc) Then
            If Not m_pedv_numdoc.Equals(value) Then
               m_pedv_numdoc = value
               OnPEDV_NumDocChanged(m_pedv_numdoc, EventArgs.Empty)
            End If
         Else
            m_pedv_numdoc = value
            OnPEDV_NumDocChanged(m_pedv_numdoc, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_SerieDoc() As String
      Get
         Return m_pedv_seriedoc
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_pedv_seriedoc) Then
            If Not m_pedv_seriedoc.Equals(value) Then
               m_pedv_seriedoc = value
               OnPEDV_SerieDocChanged(m_pedv_seriedoc, EventArgs.Empty)
            End If
         Else
            m_pedv_seriedoc = value
            OnPEDV_SerieDocChanged(m_pedv_seriedoc, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_RazonSoc() As String
      Get
         Return m_pedv_razonsoc
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_pedv_razonsoc) Then
            If Not m_pedv_razonsoc.Equals(value) Then
               m_pedv_razonsoc = value
               OnPEDV_RazonSocChanged(m_pedv_razonsoc, EventArgs.Empty)
            End If
         Else
            m_pedv_razonsoc = value
            OnPEDV_RazonSocChanged(m_pedv_razonsoc, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_Ruc() As String
      Get
         Return m_pedv_ruc
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_pedv_ruc) Then
            If Not m_pedv_ruc.Equals(value) Then
               m_pedv_ruc = value
               OnPEDV_RucChanged(m_pedv_ruc, EventArgs.Empty)
            End If
         Else
            m_pedv_ruc = value
            OnPEDV_RucChanged(m_pedv_ruc, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_Dir() As String
      Get
         Return m_pedv_dir
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_pedv_dir) Then
            If Not m_pedv_dir.Equals(value) Then
               m_pedv_dir = value
               OnPEDV_DirChanged(m_pedv_dir, EventArgs.Empty)
            End If
         Else
            m_pedv_dir = value
            OnPEDV_DirChanged(m_pedv_dir, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_Tel() As String
      Get
         Return m_pedv_tel
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_pedv_tel) Then
            If Not m_pedv_tel.Equals(value) Then
               m_pedv_tel = value
               OnPEDV_TelChanged(m_pedv_tel, EventArgs.Empty)
            End If
         Else
            m_pedv_tel = value
            OnPEDV_TelChanged(m_pedv_tel, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_Fax() As String
      Get
         Return m_pedv_fax
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_pedv_fax) Then
            If Not m_pedv_fax.Equals(value) Then
               m_pedv_fax = value
               OnPEDV_FaxChanged(m_pedv_fax, EventArgs.Empty)
            End If
         Else
            m_pedv_fax = value
            OnPEDV_FaxChanged(m_pedv_fax, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_DiasVigencia() As Short
      Get
         Return m_pedv_diasvigencia
      End Get
      Set(ByVal value As Short)
         If Not IsNothing(m_pedv_diasvigencia) Then
            If Not m_pedv_diasvigencia.Equals(value) Then
               m_pedv_diasvigencia = value
               OnPEDV_DiasVigenciaChanged(m_pedv_diasvigencia, EventArgs.Empty)
            End If
         Else
            m_pedv_diasvigencia = value
            OnPEDV_DiasVigenciaChanged(m_pedv_diasvigencia, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_HoraPedido() As DateTime
      Get
         Return m_pedv_horapedido
      End Get
      Set(ByVal value As Date)
         If Not IsNothing(m_pedv_horapedido) Then
            If Not m_pedv_horapedido.Equals(value) Then
               m_pedv_horapedido = value
               OnPEDV_HoraPedidoChanged(m_pedv_horapedido, EventArgs.Empty)
            End If
         Else
            m_pedv_horapedido = value
            OnPEDV_HoraPedidoChanged(m_pedv_horapedido, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_HoraSalReparto() As Date
      Get
         Return m_pedv_horasalreparto
      End Get
      Set(ByVal value As Date)
         If Not IsNothing(m_pedv_horasalreparto) Then
            If Not m_pedv_horasalreparto.Equals(value) Then
               m_pedv_horasalreparto = value
               OnPEDV_HoraSalRepartoChanged(m_pedv_horasalreparto, EventArgs.Empty)
            End If
         Else
            m_pedv_horasalreparto = value
            OnPEDV_HoraSalRepartoChanged(m_pedv_horasalreparto, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_HoraEntrega() As DateTime
      Get
         Return m_pedv_horaentrega
      End Get
      Set(ByVal value As Date)
         If Not IsNothing(m_pedv_horaentrega) Then
            If Not m_pedv_horaentrega.Equals(value) Then
               m_pedv_horaentrega = value
               OnPEDV_HoraEntregaChanged(m_pedv_horaentrega, EventArgs.Empty)
            End If
         Else
            m_pedv_horaentrega = value
            OnPEDV_HoraEntregaChanged(m_pedv_horaentrega, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_Salida() As String
      Get
         Return m_pedv_salida
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_pedv_salida) Then
            If Not m_pedv_salida.Equals(value) Then
               m_pedv_salida = value
               OnPEDV_SalidaChanged(m_pedv_salida, EventArgs.Empty)
            End If
         Else
            m_pedv_salida = value
            OnPEDV_SalidaChanged(m_pedv_salida, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_Llegada() As String
      Get
         Return m_pedv_llegada
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_pedv_llegada) Then
            If Not m_pedv_llegada.Equals(value) Then
               m_pedv_llegada = value
               OnPEDV_LlegadaChanged(m_pedv_llegada, EventArgs.Empty)
            End If
         Else
            m_pedv_llegada = value
            OnPEDV_LlegadaChanged(m_pedv_llegada, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property LPRV_Codigo() As String
      Get
         Return m_lprv_codigo
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_lprv_codigo) Then
            If Not m_lprv_codigo.Equals(value) Then
               m_lprv_codigo = value
               OnLPRV_CodigoChanged(m_lprv_codigo, EventArgs.Empty)
            End If
         Else
            m_lprv_codigo = value
            OnLPRV_CodigoChanged(m_lprv_codigo, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_Contacto() As Integer
      Get
         Return m_pedv_contacto
      End Get
      Set(ByVal value As Integer)
         If Not IsNothing(m_pedv_contacto) Then
            If Not m_pedv_contacto.Equals(value) Then
               m_pedv_contacto = value
               OnPEDV_ContactoChanged(m_pedv_contacto, EventArgs.Empty)
            End If
         Else
            m_pedv_contacto = value
            OnPEDV_ContactoChanged(m_pedv_contacto, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_NumRef() As Integer
      Get
         Return m_pedv_numref
      End Get
      Set(ByVal value As Integer)
         If Not IsNothing(m_pedv_numref) Then
            If Not m_pedv_numref.Equals(value) Then
               m_pedv_numref = value
               OnPEDV_NumRefChanged(m_pedv_numref, EventArgs.Empty)
            End If
         Else
            m_pedv_numref = value
            OnPEDV_NumRefChanged(m_pedv_numref, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_ExonImp1() As Boolean
      Get
         Return m_pedv_exonimp1
      End Get
      Set(ByVal value As Boolean)
         If Not m_pedv_exonimp1.Equals(value) Then
            m_pedv_exonimp1 = value
            OnPEDV_ExonImp1Changed(m_pedv_exonimp1, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property DIRE_Item() As Short
      Get
         Return m_dire_item
      End Get
      Set(ByVal value As Short)
         If Not IsNothing(m_dire_item) Then
            If Not m_dire_item.Equals(value) Then
               m_dire_item = value
               OnDIRE_ItemChanged(m_dire_item, EventArgs.Empty)
            End If
         Else
            m_dire_item = value
            OnDIRE_ItemChanged(m_dire_item, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property ENTC_CodRepartidor() As String
      Get
         Return m_entc_codrepartidor
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_entc_codrepartidor) Then
            If Not m_entc_codrepartidor.Equals(value) Then
               m_entc_codrepartidor = value
               OnENTC_CodRepartidorChanged(m_entc_codrepartidor, EventArgs.Empty)
            End If
         Else
            m_entc_codrepartidor = value
            OnENTC_CodRepartidorChanged(m_entc_codrepartidor, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property TIPE_Codigo() As String
      Get
         Return m_tipe_codigo
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_tipe_codigo) Then
            If Not m_tipe_codigo.Equals(value) Then
               m_tipe_codigo = value
               OnTIPE_CodigoChanged(m_tipe_codigo, EventArgs.Empty)
            End If
         Else
            m_tipe_codigo = value
            OnTIPE_CodigoChanged(m_tipe_codigo, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property ENTC_Codigo() As String
      Get
         Return m_entc_codigo
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_entc_codigo) Then
            If Not m_entc_codigo.Equals(value) Then
               m_entc_codigo = value
               OnENTC_CodigoChanged(m_entc_codigo, EventArgs.Empty)
            End If
         Else
            m_entc_codigo = value
            OnENTC_CodigoChanged(m_entc_codigo, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property TIPE_CodRepartidor() As String
      Get
         Return m_tipe_codrepartidor
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_tipe_codrepartidor) Then
            If Not m_tipe_codrepartidor.Equals(value) Then
               m_tipe_codrepartidor = value
               OnTIPE_CodRepartidorChanged(m_tipe_codrepartidor, EventArgs.Empty)
            End If
         Else
            m_tipe_codrepartidor = value
            OnTIPE_CodRepartidorChanged(m_tipe_codrepartidor, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property TIPO_TabDocVenta() As String
      Get
         Return m_tipo_tabdocventa
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_tipo_tabdocventa) Then
            If Not m_tipo_tabdocventa.Equals(value) Then
               m_tipo_tabdocventa = value
               OnTIPO_TabDocVentaChanged(m_tipo_tabdocventa, EventArgs.Empty)
            End If
         Else
            m_tipo_tabdocventa = value
            OnTIPO_TabDocVentaChanged(m_tipo_tabdocventa, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property TIPO_CodDocVenta() As String
      Get
         Return m_tipo_coddocventa
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_tipo_coddocventa) Then
            If Not m_tipo_coddocventa.Equals(value) Then
               m_tipo_coddocventa = value
               OnTIPO_CodDocVentaChanged(m_tipo_coddocventa, EventArgs.Empty)
            End If
         Else
            m_tipo_coddocventa = value
            OnTIPO_CodDocVentaChanged(m_tipo_coddocventa, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property TIPO_TabDocEntrega() As String
      Get
         Return m_tipo_tabdocentrega
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_tipo_tabdocentrega) Then
            If Not m_tipo_tabdocentrega.Equals(value) Then
               m_tipo_tabdocentrega = value
               OnTIPO_TabDocEntregaChanged(m_tipo_tabdocentrega, EventArgs.Empty)
            End If
         Else
            m_tipo_tabdocentrega = value
            OnTIPO_TabDocEntregaChanged(m_tipo_tabdocentrega, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property TIPO_CodDocEntrega() As String
      Get
         Return m_tipo_coddocentrega
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_tipo_coddocentrega) Then
            If Not m_tipo_coddocentrega.Equals(value) Then
               m_tipo_coddocentrega = value
               OnTIPO_CodDocEntregaChanged(m_tipo_coddocentrega, EventArgs.Empty)
            End If
         Else
            m_tipo_coddocentrega = value
            OnTIPO_CodDocEntregaChanged(m_tipo_coddocentrega, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_Tipo() As String
      Get
         Return m_pedv_tipo
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_pedv_tipo) Then
            If Not m_pedv_tipo.Equals(value) Then
               m_pedv_tipo = value
               OnPEDV_TipoChanged(m_pedv_tipo, EventArgs.Empty)
            End If
         Else
            m_pedv_tipo = value
            OnPEDV_TipoChanged(m_pedv_tipo, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_Entrega() As String
      Get
         Return m_pedv_entrega
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_pedv_entrega) Then
            If Not m_pedv_entrega.Equals(value) Then
               m_pedv_entrega = value
               OnPEDV_EntregaChanged(m_pedv_entrega, EventArgs.Empty)
            End If
         Else
            m_pedv_entrega = value
            OnPEDV_EntregaChanged(m_pedv_entrega, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_PorcDcto() As Decimal
      Get
         Return m_pedv_porcdcto
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_porcdcto) Then
            If Not m_pedv_porcdcto.Equals(value) Then
               m_pedv_porcdcto = value
               OnPEDV_PorcDctoChanged(m_pedv_porcdcto, EventArgs.Empty)
            End If
         Else
            m_pedv_porcdcto = value
            OnPEDV_PorcDctoChanged(m_pedv_porcdcto, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property TIPE_CodTrans() As String
      Get
         Return m_tipe_codtrans
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_tipe_codtrans) Then
            If Not m_tipe_codtrans.Equals(value) Then
               m_tipe_codtrans = value
               OnTIPE_CodTransChanged(m_tipe_codtrans, EventArgs.Empty)
            End If
         Else
            m_tipe_codtrans = value
            OnTIPE_CodTransChanged(m_tipe_codtrans, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property ENTC_CodTrans() As String
      Get
         Return m_entc_codtrans
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_entc_codtrans) Then
            If Not m_entc_codtrans.Equals(value) Then
               m_entc_codtrans = value
               OnENTC_CodTransChanged(m_entc_codtrans, EventArgs.Empty)
            End If
         Else
            m_entc_codtrans = value
            OnENTC_CodTransChanged(m_entc_codtrans, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property VEHI_Placa() As String
      Get
         Return m_vehi_placa
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_vehi_placa) Then
            If Not m_vehi_placa.Equals(value) Then
               m_vehi_placa = value
               OnVEHI_PlacaChanged(m_vehi_placa, EventArgs.Empty)
            End If
         Else
            m_vehi_placa = value
            OnVEHI_PlacaChanged(m_vehi_placa, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_PagoParcial() As Decimal
      Get
         Return m_pedv_pagoparcial
      End Get
      Set(ByVal value As Decimal)
         If Not IsNothing(m_pedv_pagoparcial) Then
            If Not m_pedv_pagoparcial.Equals(value) Then
               m_pedv_pagoparcial = value
               OnPEDV_PagoParcialChanged(m_pedv_pagoparcial, EventArgs.Empty)
            End If
         Else
            m_pedv_pagoparcial = value
            OnPEDV_PagoParcialChanged(m_pedv_pagoparcial, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PVTA_Codigo() As String
      Get
         Return m_pvta_codigo
      End Get
      Set(ByVal value As String)
         If Not IsNothing(m_pvta_codigo) Then
            If Not m_pvta_codigo.Equals(value) Then
               m_pvta_codigo = value
               OnPVTA_CodigoChanged(m_pvta_codigo, EventArgs.Empty)
            End If
         Else
            m_pvta_codigo = value
            OnPVTA_CodigoChanged(m_pvta_codigo, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property rowguid() As Guid
      Get
         Return m_rowguid
      End Get
      Set(ByVal value As Guid)
         If Not IsNothing(m_rowguid) Then
            If Not m_rowguid.Equals(value) Then
               m_rowguid = value
               OnrowguidChanged(m_rowguid, EventArgs.Empty)
            End If
         Else
            m_rowguid = value
            OnrowguidChanged(m_rowguid, EventArgs.Empty)
         End If
      End Set
   End Property
   Public Property PEDV_UsrCrea() As String
      Get
         Return m_pedv_usrcrea
      End Get
      Set(ByVal value As String)
         m_pedv_usrcrea = value
      End Set
   End Property
   Public Property PEDV_FecCrea() As Date
      Get
         Return m_pedv_feccrea
      End Get
      Set(ByVal value As Date)
         m_pedv_feccrea = value
      End Set
   End Property
   Public Property PEDV_UsrMod() As String
      Get
         Return m_pedv_usrmod
      End Get
      Set(ByVal value As String)
         m_pedv_usrmod = value
      End Set
   End Property
   Public Property PEDV_FecMod() As Date
      Get
         Return m_pedv_fecmod
      End Get
      Set(ByVal value As Date)
         m_pedv_fecmod = value
      End Set
   End Property
   Public ReadOnly Property Nuevo() As Boolean
      Get
         Return m_nuevo
      End Get
   End Property
   Public ReadOnly Property Modificado() As Boolean
      Get
         Return m_modificado
      End Get
   End Property
   Public ReadOnly Property Eliminado() As Boolean
      Get
         Return m_eliminado
      End Get
   End Property

   Public ReadOnly Property PEDV_CostoTotal() As Decimal
      Get
         m_pedv_costototal = 0
         For Each Item As EVEN_DetPedidos In m_listDetPedidos
            m_pedv_costototal += Item.DPEV_CantXCosto
         Next
         Return m_pedv_costototal
      End Get
   End Property

   Public ReadOnly Property PEDV_UtilidadExtra() As Decimal
      Get
         Try
            Return PEDV_PrecioParcialConDcto * 100 / PEDV_CostoTotal - 100
         Catch ex As Exception
            Return 0
         End Try
      End Get
   End Property

   Public ReadOnly Property PEDV_UtilidadTotal() As Decimal
      Get
         Dim _utilidad As Decimal = 0
         For Each Item As EVEN_DetPedidos In m_listDetPedidos
            _utilidad += Item.DPEV_UtilidadPedido
         Next
         Return _utilidad
      End Get
   End Property

   Public Property DOCV_Numero() As Integer
      Get
         Return m_docv_numero
      End Get
      Set(ByVal value As Integer)
         If Not IsNothing(m_docv_numero) Then
            If Not m_docv_numero.Equals(value) Then
               m_docv_numero = value
               OnDOCV_NumeroChanged(m_docv_numero, EventArgs.Empty)
            End If
         Else
            m_docv_numero = value
            OnDOCV_NumeroChanged(m_docv_numero, EventArgs.Empty)
         End If
      End Set
   End Property

#End Region

#Region " Campos Adicionales "
   Private m_pvta_desc As String
   Private m_entc_razonsoc As String
   Private m_entc_ruc As String
   Private m_entc_tel1 As String
   Private m_entc_tel2 As String
   Private m_entc_tel3 As String
   Private m_entc_email As String
   Private m_dire_desc As String
   Private m_vend_razonsoc As String
   Private m_tipo_desctdo As String
   Private m_tipo_descmnd As String
   Private m_tipo_descfpg As String
   Private m_vges_fecha As Date
   Private m_vges_vendedor As String
   Private m_vges_observacion As String
   Private m_resg_desc As String
   Private m_vges_fecproxvisita As Date
#End Region

#Region " Propiedades Adicionales "
   Public ReadOnly Property PEDV_ValorTotal() As Decimal
      Get
         If m_tipo_codmoneda = "001" Then
            Return m_pedv_valortotals
         Else
            Return m_pedv_valortotald
         End If
      End Get
   End Property

   Public Property PVTA_Desc() As String
      Get
         Return m_pvta_desc
      End Get
      Set(ByVal value As String)
         m_pvta_desc = value
      End Set
   End Property
   Public Property ENTC_RazonSoc() As String
      Get
         Return m_entc_razonsoc
      End Get
      Set(ByVal value As String)
         m_entc_razonsoc = value
      End Set
   End Property
   Public Property ENTC_Ruc() As String
      Get
         Return m_entc_ruc
      End Get
      Set(ByVal value As String)
         m_entc_ruc = value
      End Set
   End Property
   Public Property ENTC_Tel1() As String
      Get
         Return m_entc_tel1
      End Get
      Set(ByVal value As String)
         m_entc_tel1 = value
      End Set
   End Property
   Public Property ENTC_Tel2() As String
      Get
         Return m_entc_tel2
      End Get
      Set(ByVal value As String)
         m_entc_tel2 = value
      End Set
   End Property
   Public Property ENTC_Tel3() As String
      Get
         Return m_entc_tel3
      End Get
      Set(ByVal value As String)
         m_entc_tel3 = value
      End Set
   End Property
   Public Property ENTC_Email() As String
      Get
         Return m_entc_email
      End Get
      Set(ByVal value As String)
         m_entc_email = value
      End Set
   End Property
   Public Property DIRE_Desc() As String
      Get
         Return m_dire_desc
      End Get
      Set(ByVal value As String)
         m_dire_desc = value
      End Set
   End Property
   Public Property VEND_RazonSoc() As String
      Get
         Return m_vend_razonsoc
      End Get
      Set(ByVal value As String)
         m_vend_razonsoc = value
      End Set
   End Property
   Public Property TIPO_DescTDO() As String
      Get
         Return m_tipo_desctdo
      End Get
      Set(ByVal value As String)
         m_tipo_desctdo = value
      End Set
   End Property
   Public Property TIPO_DescMND() As String
      Get
         Return m_tipo_descmnd
      End Get
      Set(ByVal value As String)
         m_tipo_descmnd = value
      End Set
   End Property
   Public Property TIPO_DescFPG() As String
      Get
         Return m_tipo_descfpg
      End Get
      Set(ByVal value As String)
         m_tipo_descfpg = value
      End Set
   End Property
   Public Property VGES_Fecha() As Date
      Get
         Return m_vges_fecha
      End Get
      Set(ByVal value As Date)
         m_vges_fecha = value
      End Set
   End Property
   Public Property VGES_Vendedor() As String
      Get
         Return m_vges_vendedor
      End Get
      Set(ByVal value As String)
         m_vges_vendedor = value
      End Set
   End Property
   Public Property VGES_Observacion() As String
      Get
         Return m_vges_observacion
      End Get
      Set(ByVal value As String)
         m_vges_observacion = value
      End Set
   End Property
   Public Property RESG_Desc() As String
      Get
         Return m_resg_desc
      End Get
      Set(ByVal value As String)
         m_resg_desc = value
      End Set
   End Property
   Public Property VGES_FecProxVisita() As Date
      Get
         Return m_vges_fecproxvisita
      End Get
      Set(ByVal value As Date)
         m_vges_fecproxvisita = value
      End Set
   End Property

   Public ReadOnly Property PEDV_Comision() As Decimal
      Get
         Dim _comision As Decimal = 0
         If Not IsNothing(m_listDetPedidos) Then
            If m_listDetPedidos.Count > 0 Then
               For Each _det_pedido As EVEN_DetPedidos In m_listDetPedidos
                  _comision += _det_pedido.DPEV_Comision
               Next
            End If
         End If
         Return _comision
      End Get
   End Property
   Public ReadOnly Property PEDV_Utilidad() As Decimal
      Get
         Dim _utilidad As Decimal = 0
         If Not IsNothing(m_listDetPedidos) Then
            If m_listDetPedidos.Count > 0 Then
               For Each _det_pedido As EVEN_DetPedidos In m_listDetPedidos
                  _utilidad += _det_pedido.DPEV_Utilidad
               Next
            End If
         End If
         Return _utilidad
      End Get
   End Property

   Public ReadOnly Property PEDV_PrecioParcialSinDcto() As Decimal
      Get
         Dim _precParcialSinDcto As Decimal = 0
         For Each _detalle As EVEN_DetPedidos In m_listDetPedidos
            _precParcialSinDcto += _detalle.DPEV_PrecParcialSinDcto
         Next
         Return _precParcialSinDcto
      End Get
   End Property
   Public ReadOnly Property PEDV_PrecioParcialConDcto() As Decimal
      Get
         Dim _subtotal As Decimal = 0
         If Not IsNothing(m_listDetPedidos) Then
            If m_listDetPedidos.Count > 0 Then
               For Each _det_pedido As EVEN_DetPedidos In m_listDetPedidos
                  _subtotal += _det_pedido.DPEV_PrecParcialConDcto
               Next
            End If
         End If
         Return _subtotal
      End Get
   End Property
   Public ReadOnly Property PEDV_Dcto() As Decimal
      Get
         Dim _dcto As Decimal = 0
         For Each _detalle As EVEN_DetPedidos In m_listDetPedidos
            _dcto += _detalle.DPEV_Dcto
         Next
         Return _dcto
      End Get
   End Property
   Public ReadOnly Property PEDV_ValorVtaParcial() As Decimal
      Get
         Dim _valorVtaParcial As Decimal = 0
         For Each _detalle As EVEN_DetPedidos In m_listDetPedidos
            _valorVtaParcial += _detalle.DPEV_ValorVtaParcial
         Next
         Return _valorVtaParcial
      End Get
   End Property

   Public Property TIPO_CodRGS() As String
      Get
         Return m_tipo_codrgs
      End Get
      Set(ByVal value As String)
         m_tipo_codrgs = value
      End Set
   End Property

   Public ReadOnly Property Gestionado() As Boolean
      Get
         If IsNothing(m_tipo_codrgs) Then
            Return False
         Else
            Return (m_tipo_codrgs.Trim().Length > 0)
         End If
      End Get
   End Property


  
#End Region

#Region " Relaciones "
   Private m_listDetPedidos As List(Of EVEN_DetPedidos)

   Public Property ListDetPedidos() As List(Of EVEN_DetPedidos)
      Get
         Return m_listDetPedidos
      End Get
      Set(ByVal value As List(Of EVEN_DetPedidos))
         m_listDetPedidos = value
      End Set
   End Property
#End Region

#Region " Eventos "
   Public Event SUCR_CodigoChanged As EventHandler
   Public Event PEDV_NumeroChanged As EventHandler
   Public Event TIPO_TabDocChanged As EventHandler
   Public Event TIPO_CodMotAnulaChanged As EventHandler
   Public Event TIPO_TabMotAnulaChanged As EventHandler
   Public Event TIPO_CodDocChanged As EventHandler
   Public Event TIPO_CodFPGChanged As EventHandler
   Public Event TIPO_TabFPGChanged As EventHandler
   Public Event TIPO_TabMonedaChanged As EventHandler
   Public Event TIPO_CodMonedaChanged As EventHandler
   Public Event VEND_CodigoChanged As EventHandler
   Public Event PEDV_TipoCambioChanged As EventHandler
   Public Event PEDV_FecEmiChanged As EventHandler
   Public Event PEDV_FecVcmtoChanged As EventHandler
   Public Event PEDV_PctjComiVenChanged As EventHandler
   Public Event PEDV_EstadoChanged As EventHandler
   Public Event PEDV_ObservacionesChanged As EventHandler
   Public Event PEDV_ValorTotalSChanged As EventHandler
   Public Event PEDV_ValorTotalDChanged As EventHandler
   Public Event PEDV_ValorVtaTotalSChanged As EventHandler
   Public Event PEDV_ValorVtaTotalDChanged As EventHandler
   Public Event PEDV_PrecVtaTotalSChanged As EventHandler
   Public Event PEDV_PrecVtaTotalDChanged As EventHandler
   Public Event PEDV_FleteTotalSChanged As EventHandler
   Public Event PEDV_FleteTotalDChanged As EventHandler
   Public Event PEDV_DctoTotalSChanged As EventHandler
   Public Event PEDV_DctoTotalDChanged As EventHandler
   Public Event PEDV_Imp1TotalSChanged As EventHandler
   Public Event PEDV_Imp1TotalDChanged As EventHandler
   Public Event PEDV_Imp2TotalSChanged As EventHandler
   Public Event PEDV_Imp2TotalDChanged As EventHandler
   Public Event PEDV_Imp3TotalSChanged As EventHandler
   Public Event PEDV_Imp3TotalDChanged As EventHandler
   Public Event PEDV_Imp4TotalSChanged As EventHandler
   Public Event PEDV_Imp4TotalDChanged As EventHandler
   Public Event PEDV_PorcImp1Changed As EventHandler
   Public Event PEDV_PorcImp2Changed As EventHandler
   Public Event PEDV_PorcImp3Changed As EventHandler
   Public Event PEDV_PorcImp4Changed As EventHandler
   Public Event PEDV_NumDocChanged As EventHandler
   Public Event PEDV_SerieDocChanged As EventHandler
   Public Event PEDV_RazonSocChanged As EventHandler
   Public Event PEDV_RucChanged As EventHandler
   Public Event PEDV_DirChanged As EventHandler
   Public Event PEDV_TelChanged As EventHandler
   Public Event PEDV_FaxChanged As EventHandler
   Public Event PEDV_DiasVigenciaChanged As EventHandler
   Public Event PEDV_HoraPedidoChanged As EventHandler
   Public Event PEDV_HoraSalRepartoChanged As EventHandler
   Public Event PEDV_HoraEntregaChanged As EventHandler
   Public Event PEDV_SalidaChanged As EventHandler
   Public Event PEDV_LlegadaChanged As EventHandler
   Public Event LPRV_CodigoChanged As EventHandler
   Public Event PEDV_ContactoChanged As EventHandler
   Public Event PEDV_NumRefChanged As EventHandler
   Public Event PEDV_ExonImp1Changed As EventHandler
   Public Event DIRE_ItemChanged As EventHandler
   Public Event ENTC_CodRepartidorChanged As EventHandler
   Public Event TIPE_CodigoChanged As EventHandler
   Public Event ENTC_CodigoChanged As EventHandler
   Public Event TIPE_CodRepartidorChanged As EventHandler
   Public Event TIPO_TabDocVentaChanged As EventHandler
   Public Event TIPO_CodDocVentaChanged As EventHandler
   Public Event TIPO_TabDocEntregaChanged As EventHandler
   Public Event TIPO_CodDocEntregaChanged As EventHandler
   Public Event PEDV_TipoChanged As EventHandler
   Public Event PEDV_EntregaChanged As EventHandler
   Public Event PEDV_PorcDctoChanged As EventHandler
   Public Event TIPE_CodTransChanged As EventHandler
   Public Event ENTC_CodTransChanged As EventHandler
   Public Event VEHI_PlacaChanged As EventHandler
   Public Event PEDV_PagoParcialChanged As EventHandler
   Public Event PVTA_CodigoChanged As EventHandler
   Public Event rowguidChanged As EventHandler

   Public Event DOCV_NumeroChanged As EventHandler

   Public Sub OnSUCR_CodigoChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent SUCR_CodigoChanged(sender, e)
   End Sub
   Public Sub OnPEDV_NumeroChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_NumeroChanged(sender, e)
   End Sub
   Public Sub OnTIPO_TabDocChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent TIPO_TabDocChanged(sender, e)
   End Sub
   Public Sub OnTIPO_CodMotAnulaChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent TIPO_CodMotAnulaChanged(sender, e)
   End Sub
   Public Sub OnTIPO_TabMotAnulaChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent TIPO_TabMotAnulaChanged(sender, e)
   End Sub
   Public Sub OnTIPO_CodDocChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent TIPO_CodDocChanged(sender, e)
   End Sub
   Public Sub OnTIPO_CodFPGChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent TIPO_CodFPGChanged(sender, e)
   End Sub
   Public Sub OnTIPO_TabFPGChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent TIPO_TabFPGChanged(sender, e)
   End Sub
   Public Sub OnTIPO_TabMonedaChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent TIPO_TabMonedaChanged(sender, e)
   End Sub
   Public Sub OnTIPO_CodMonedaChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent TIPO_CodMonedaChanged(sender, e)
   End Sub
   Public Sub OnVEND_CodigoChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent VEND_CodigoChanged(sender, e)
   End Sub
   Public Sub OnPEDV_TipoCambioChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_TipoCambioChanged(sender, e)
   End Sub
   Public Sub OnPEDV_FecEmiChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_FecEmiChanged(sender, e)
   End Sub
   Public Sub OnPEDV_FecVcmtoChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_FecVcmtoChanged(sender, e)
   End Sub
   Public Sub OnPEDV_PctjComiVenChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_PctjComiVenChanged(sender, e)
   End Sub
   Public Sub OnPEDV_EstadoChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_EstadoChanged(sender, e)
   End Sub
   Public Sub OnPEDV_ObservacionesChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_ObservacionesChanged(sender, e)
   End Sub
   Public Sub OnPEDV_ValorTotalSChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_ValorTotalSChanged(sender, e)
   End Sub
   Public Sub OnPEDV_ValorTotalDChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_ValorTotalDChanged(sender, e)
   End Sub
   Public Sub OnPEDV_ValorVtaTotalSChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_ValorVtaTotalSChanged(sender, e)
   End Sub
   Public Sub OnPEDV_ValorVtaTotalDChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_ValorVtaTotalDChanged(sender, e)
   End Sub
   Public Sub OnPEDV_PrecVtaTotalSChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_PrecVtaTotalSChanged(sender, e)
   End Sub
   Public Sub OnPEDV_PrecVtaTotalDChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_PrecVtaTotalDChanged(sender, e)
   End Sub
   Public Sub OnPEDV_FleteTotalSChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_FleteTotalSChanged(sender, e)
   End Sub
   Public Sub OnPEDV_FleteTotalDChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_FleteTotalDChanged(sender, e)
   End Sub
   Public Sub OnPEDV_DctoTotalSChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_DctoTotalSChanged(sender, e)
   End Sub
   Public Sub OnPEDV_DctoTotalDChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_DctoTotalDChanged(sender, e)
   End Sub
   Public Sub OnPEDV_Imp1TotalSChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_Imp1TotalSChanged(sender, e)
   End Sub
   Public Sub OnPEDV_Imp1TotalDChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_Imp1TotalDChanged(sender, e)
   End Sub
   Public Sub OnPEDV_Imp2TotalSChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_Imp2TotalSChanged(sender, e)
   End Sub
   Public Sub OnPEDV_Imp2TotalDChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_Imp2TotalDChanged(sender, e)
   End Sub
   Public Sub OnPEDV_Imp3TotalSChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_Imp3TotalSChanged(sender, e)
   End Sub
   Public Sub OnPEDV_Imp3TotalDChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_Imp3TotalDChanged(sender, e)
   End Sub
   Public Sub OnPEDV_Imp4TotalSChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_Imp4TotalSChanged(sender, e)
   End Sub
   Public Sub OnPEDV_Imp4TotalDChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_Imp4TotalDChanged(sender, e)
   End Sub
   Public Sub OnPEDV_PorcImp1Changed(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_PorcImp1Changed(sender, e)
   End Sub
   Public Sub OnPEDV_PorcImp2Changed(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_PorcImp2Changed(sender, e)
   End Sub
   Public Sub OnPEDV_PorcImp3Changed(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_PorcImp3Changed(sender, e)
   End Sub
   Public Sub OnPEDV_PorcImp4Changed(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_PorcImp4Changed(sender, e)
   End Sub
   Public Sub OnPEDV_NumDocChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_NumDocChanged(sender, e)
   End Sub
   Public Sub OnPEDV_SerieDocChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_SerieDocChanged(sender, e)
   End Sub
   Public Sub OnPEDV_RazonSocChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_RazonSocChanged(sender, e)
   End Sub
   Public Sub OnPEDV_RucChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_RucChanged(sender, e)
   End Sub
   Public Sub OnPEDV_DirChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_DirChanged(sender, e)
   End Sub
   Public Sub OnPEDV_TelChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_TelChanged(sender, e)
   End Sub
   Public Sub OnPEDV_FaxChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_FaxChanged(sender, e)
   End Sub
   Public Sub OnPEDV_DiasVigenciaChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_DiasVigenciaChanged(sender, e)
   End Sub
   Public Sub OnPEDV_HoraPedidoChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_HoraPedidoChanged(sender, e)
   End Sub
   Public Sub OnPEDV_HoraSalRepartoChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_HoraSalRepartoChanged(sender, e)
   End Sub
   Public Sub OnPEDV_HoraEntregaChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_HoraEntregaChanged(sender, e)
   End Sub
   Public Sub OnPEDV_SalidaChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_SalidaChanged(sender, e)
   End Sub
   Public Sub OnPEDV_LlegadaChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_LlegadaChanged(sender, e)
   End Sub
   Public Sub OnLPRV_CodigoChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent LPRV_CodigoChanged(sender, e)
   End Sub
   Public Sub OnPEDV_ContactoChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_ContactoChanged(sender, e)
   End Sub
   Public Sub OnPEDV_NumRefChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_NumRefChanged(sender, e)
   End Sub
   Public Sub OnPEDV_ExonImp1Changed(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_ExonImp1Changed(sender, e)
   End Sub
   Public Sub OnDIRE_ItemChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent DIRE_ItemChanged(sender, e)
   End Sub
   Public Sub OnENTC_CodRepartidorChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent ENTC_CodRepartidorChanged(sender, e)
   End Sub
   Public Sub OnTIPE_CodigoChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent TIPE_CodigoChanged(sender, e)
   End Sub
   Public Sub OnENTC_CodigoChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent ENTC_CodigoChanged(sender, e)
   End Sub
   Public Sub OnTIPE_CodRepartidorChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent TIPE_CodRepartidorChanged(sender, e)
   End Sub
   Public Sub OnTIPO_TabDocVentaChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent TIPO_TabDocVentaChanged(sender, e)
   End Sub
   Public Sub OnTIPO_CodDocVentaChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent TIPO_CodDocVentaChanged(sender, e)
   End Sub
   Public Sub OnTIPO_TabDocEntregaChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent TIPO_TabDocEntregaChanged(sender, e)
   End Sub
   Public Sub OnTIPO_CodDocEntregaChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent TIPO_CodDocEntregaChanged(sender, e)
   End Sub
   Public Sub OnPEDV_TipoChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_TipoChanged(sender, e)
   End Sub
   Public Sub OnPEDV_EntregaChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_EntregaChanged(sender, e)
   End Sub
   Public Sub OnPEDV_PorcDctoChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_PorcDctoChanged(sender, e)
   End Sub
   Public Sub OnTIPE_CodTransChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent TIPE_CodTransChanged(sender, e)
   End Sub
   Public Sub OnENTC_CodTransChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent ENTC_CodTransChanged(sender, e)
   End Sub
   Public Sub OnVEHI_PlacaChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent VEHI_PlacaChanged(sender, e)
   End Sub
   Public Sub OnPEDV_PagoParcialChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PEDV_PagoParcialChanged(sender, e)
   End Sub
   Public Sub OnPVTA_CodigoChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent PVTA_CodigoChanged(sender, e)
   End Sub
   Public Sub OnrowguidChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent rowguidChanged(sender, e)
   End Sub

   Public Sub OnDOCV_NumeroChanged(ByVal sender As Object, ByVal e As EventArgs)
      ActualizarInstancia()
      RaiseEvent DOCV_NumeroChanged(sender, e)
   End Sub
#End Region

#Region " Metodos "
   Public Enum NSEInstancia
      Consulta
      Nuevo
      Modificado
      Eliminado
   End Enum
   Public Sub Instanciar(ByVal x_instancia As NSEInstancia)
      Select Case x_instancia
         Case NSEInstancia.Consulta
            m_nuevo = False
            m_modificado = False
            m_eliminado = False
         Case NSEInstancia.Nuevo
            m_nuevo = True
            m_modificado = False
            m_eliminado = False
         Case NSEInstancia.Modificado
            m_nuevo = False
            m_modificado = True
            m_eliminado = False
         Case NSEInstancia.Eliminado
            m_nuevo = False
            m_modificado = False
            m_eliminado = True
      End Select
   End Sub
   Public Sub ActualizarInstancia()
      If Not Nuevo Then
         If Not Eliminado Then
            Instanciar(NSEInstancia.Modificado)
         End If
      End If
   End Sub
#End Region

#Region " Metodos Compartidos "
   Private Shared m_columnas As DataTable

   Public Shared Property Columnas() As DataTable
      Get
         Return m_columnas
      End Get
      Set(ByVal value As DataTable)
         m_columnas = value
      End Set
   End Property

   Private Shared Function ReaderContiene(ByVal columnaNombre As String) As Boolean
      Try
         For Each columna As DataRow In m_columnas.Rows
            If columna("ColumnName").ToString() = columnaNombre Then
               Return True
            End If
         Next
         Return False
      Catch
         Throw New Exception("No se han definido las columnas del DbDataReader en la clase: EVEN_Pedidos.")
      End Try
   End Function

   Public Shared Sub Cargar_Esquema(ByVal reader As DbDataReader, ByRef e_ven_pedidos As EVEN_Pedidos)
      Try
         If ReaderContiene("SUCR_Codigo") Then e_ven_pedidos.SUCR_Codigo = IIf(Not reader("SUCR_Codigo") Is System.DBNull.Value, reader("SUCR_Codigo"), Nothing)
         If ReaderContiene("PEDV_Numero") Then e_ven_pedidos.PEDV_Numero = IIf(Not reader("PEDV_Numero") Is System.DBNull.Value, reader("PEDV_Numero"), Nothing)
         If ReaderContiene("TIPO_TabDoc") Then e_ven_pedidos.TIPO_TabDoc = IIf(Not reader("TIPO_TabDoc") Is System.DBNull.Value, reader("TIPO_TabDoc"), Nothing)
         If ReaderContiene("TIPO_CodMotAnula") Then e_ven_pedidos.TIPO_CodMotAnula = IIf(Not reader("TIPO_CodMotAnula") Is System.DBNull.Value, reader("TIPO_CodMotAnula"), Nothing)
         If ReaderContiene("TIPO_TabMotAnula") Then e_ven_pedidos.TIPO_TabMotAnula = IIf(Not reader("TIPO_TabMotAnula") Is System.DBNull.Value, reader("TIPO_TabMotAnula"), Nothing)
         If ReaderContiene("TIPO_CodDoc") Then e_ven_pedidos.TIPO_CodDoc = IIf(Not reader("TIPO_CodDoc") Is System.DBNull.Value, reader("TIPO_CodDoc"), Nothing)
         If ReaderContiene("TIPO_CodFPG") Then e_ven_pedidos.TIPO_CodFPG = IIf(Not reader("TIPO_CodFPG") Is System.DBNull.Value, reader("TIPO_CodFPG"), Nothing)
         If ReaderContiene("TIPO_TabFPG") Then e_ven_pedidos.TIPO_TabFPG = IIf(Not reader("TIPO_TabFPG") Is System.DBNull.Value, reader("TIPO_TabFPG"), Nothing)
         If ReaderContiene("TIPO_TabMoneda") Then e_ven_pedidos.TIPO_TabMoneda = IIf(Not reader("TIPO_TabMoneda") Is System.DBNull.Value, reader("TIPO_TabMoneda"), Nothing)
         If ReaderContiene("TIPO_CodMoneda") Then e_ven_pedidos.TIPO_CodMoneda = IIf(Not reader("TIPO_CodMoneda") Is System.DBNull.Value, reader("TIPO_CodMoneda"), Nothing)
         If ReaderContiene("VEND_Codigo") Then e_ven_pedidos.VEND_Codigo = IIf(Not reader("VEND_Codigo") Is System.DBNull.Value, reader("VEND_Codigo"), Nothing)
         If ReaderContiene("PEDV_TipoCambio") Then e_ven_pedidos.PEDV_TipoCambio = IIf(Not reader("PEDV_TipoCambio") Is System.DBNull.Value, reader("PEDV_TipoCambio"), Nothing)
         If ReaderContiene("PEDV_FecEmi") Then e_ven_pedidos.PEDV_FecEmi = IIf(Not reader("PEDV_FecEmi") Is System.DBNull.Value, reader("PEDV_FecEmi"), Nothing)
         If ReaderContiene("PEDV_FecVcmto") Then e_ven_pedidos.PEDV_FecVcmto = IIf(Not reader("PEDV_FecVcmto") Is System.DBNull.Value, reader("PEDV_FecVcmto"), Nothing)
         If ReaderContiene("PEDV_PctjComiVen") Then e_ven_pedidos.PEDV_PctjComiVen = IIf(Not reader("PEDV_PctjComiVen") Is System.DBNull.Value, reader("PEDV_PctjComiVen"), Nothing)
         If ReaderContiene("PEDV_Estado") Then e_ven_pedidos.PEDV_Estado = IIf(Not reader("PEDV_Estado") Is System.DBNull.Value, reader("PEDV_Estado"), Nothing)
         If ReaderContiene("PEDV_Observaciones") Then e_ven_pedidos.PEDV_Observaciones = IIf(Not reader("PEDV_Observaciones") Is System.DBNull.Value, reader("PEDV_Observaciones"), Nothing)
         If ReaderContiene("PEDV_ValorTotalS") Then e_ven_pedidos.PEDV_ValorTotalS = IIf(Not reader("PEDV_ValorTotalS") Is System.DBNull.Value, reader("PEDV_ValorTotalS"), Nothing)
         If ReaderContiene("PEDV_ValorTotalD") Then e_ven_pedidos.PEDV_ValorTotalD = IIf(Not reader("PEDV_ValorTotalD") Is System.DBNull.Value, reader("PEDV_ValorTotalD"), Nothing)
         If ReaderContiene("PEDV_ValorVtaTotalS") Then e_ven_pedidos.PEDV_ValorVtaTotalS = IIf(Not reader("PEDV_ValorVtaTotalS") Is System.DBNull.Value, reader("PEDV_ValorVtaTotalS"), Nothing)
         If ReaderContiene("PEDV_ValorVtaTotalD") Then e_ven_pedidos.PEDV_ValorVtaTotalD = IIf(Not reader("PEDV_ValorVtaTotalD") Is System.DBNull.Value, reader("PEDV_ValorVtaTotalD"), Nothing)
         If ReaderContiene("PEDV_PrecVtaTotalS") Then e_ven_pedidos.PEDV_PrecVtaTotalS = IIf(Not reader("PEDV_PrecVtaTotalS") Is System.DBNull.Value, reader("PEDV_PrecVtaTotalS"), Nothing)
         If ReaderContiene("PEDV_PrecVtaTotalD") Then e_ven_pedidos.PEDV_PrecVtaTotalD = IIf(Not reader("PEDV_PrecVtaTotalD") Is System.DBNull.Value, reader("PEDV_PrecVtaTotalD"), Nothing)
         If ReaderContiene("PEDV_FleteTotalS") Then e_ven_pedidos.PEDV_FleteTotalS = IIf(Not reader("PEDV_FleteTotalS") Is System.DBNull.Value, reader("PEDV_FleteTotalS"), Nothing)
         If ReaderContiene("PEDV_FleteTotalD") Then e_ven_pedidos.PEDV_FleteTotalD = IIf(Not reader("PEDV_FleteTotalD") Is System.DBNull.Value, reader("PEDV_FleteTotalD"), Nothing)
         If ReaderContiene("PEDV_DctoTotalS") Then e_ven_pedidos.PEDV_DctoTotalS = IIf(Not reader("PEDV_DctoTotalS") Is System.DBNull.Value, reader("PEDV_DctoTotalS"), Nothing)
         If ReaderContiene("PEDV_DctoTotalD") Then e_ven_pedidos.PEDV_DctoTotalD = IIf(Not reader("PEDV_DctoTotalD") Is System.DBNull.Value, reader("PEDV_DctoTotalD"), Nothing)
         If ReaderContiene("PEDV_Imp1TotalS") Then e_ven_pedidos.PEDV_Imp1TotalS = IIf(Not reader("PEDV_Imp1TotalS") Is System.DBNull.Value, reader("PEDV_Imp1TotalS"), Nothing)
         If ReaderContiene("PEDV_Imp1TotalD") Then e_ven_pedidos.PEDV_Imp1TotalD = IIf(Not reader("PEDV_Imp1TotalD") Is System.DBNull.Value, reader("PEDV_Imp1TotalD"), Nothing)
         If ReaderContiene("PEDV_Imp2TotalS") Then e_ven_pedidos.PEDV_Imp2TotalS = IIf(Not reader("PEDV_Imp2TotalS") Is System.DBNull.Value, reader("PEDV_Imp2TotalS"), Nothing)
         If ReaderContiene("PEDV_Imp2TotalD") Then e_ven_pedidos.PEDV_Imp2TotalD = IIf(Not reader("PEDV_Imp2TotalD") Is System.DBNull.Value, reader("PEDV_Imp2TotalD"), Nothing)
         If ReaderContiene("PEDV_Imp3TotalS") Then e_ven_pedidos.PEDV_Imp3TotalS = IIf(Not reader("PEDV_Imp3TotalS") Is System.DBNull.Value, reader("PEDV_Imp3TotalS"), Nothing)
         If ReaderContiene("PEDV_Imp3TotalD") Then e_ven_pedidos.PEDV_Imp3TotalD = IIf(Not reader("PEDV_Imp3TotalD") Is System.DBNull.Value, reader("PEDV_Imp3TotalD"), Nothing)
         If ReaderContiene("PEDV_Imp4TotalS") Then e_ven_pedidos.PEDV_Imp4TotalS = IIf(Not reader("PEDV_Imp4TotalS") Is System.DBNull.Value, reader("PEDV_Imp4TotalS"), Nothing)
         If ReaderContiene("PEDV_Imp4TotalD") Then e_ven_pedidos.PEDV_Imp4TotalD = IIf(Not reader("PEDV_Imp4TotalD") Is System.DBNull.Value, reader("PEDV_Imp4TotalD"), Nothing)
         If ReaderContiene("PEDV_PorcImp1") Then e_ven_pedidos.PEDV_PorcImp1 = IIf(Not reader("PEDV_PorcImp1") Is System.DBNull.Value, reader("PEDV_PorcImp1"), Nothing)
         If ReaderContiene("PEDV_PorcImp2") Then e_ven_pedidos.PEDV_PorcImp2 = IIf(Not reader("PEDV_PorcImp2") Is System.DBNull.Value, reader("PEDV_PorcImp2"), Nothing)
         If ReaderContiene("PEDV_PorcImp3") Then e_ven_pedidos.PEDV_PorcImp3 = IIf(Not reader("PEDV_PorcImp3") Is System.DBNull.Value, reader("PEDV_PorcImp3"), Nothing)
         If ReaderContiene("PEDV_PorcImp4") Then e_ven_pedidos.PEDV_PorcImp4 = IIf(Not reader("PEDV_PorcImp4") Is System.DBNull.Value, reader("PEDV_PorcImp4"), Nothing)
         If ReaderContiene("PEDV_NumDoc") Then e_ven_pedidos.PEDV_NumDoc = IIf(Not reader("PEDV_NumDoc") Is System.DBNull.Value, reader("PEDV_NumDoc"), Nothing)
         If ReaderContiene("PEDV_SerieDoc") Then e_ven_pedidos.PEDV_SerieDoc = IIf(Not reader("PEDV_SerieDoc") Is System.DBNull.Value, reader("PEDV_SerieDoc"), Nothing)
         If ReaderContiene("PEDV_RazonSoc") Then e_ven_pedidos.PEDV_RazonSoc = IIf(Not reader("PEDV_RazonSoc") Is System.DBNull.Value, reader("PEDV_RazonSoc"), Nothing)
         If ReaderContiene("PEDV_Ruc") Then e_ven_pedidos.PEDV_Ruc = IIf(Not reader("PEDV_Ruc") Is System.DBNull.Value, reader("PEDV_Ruc"), Nothing)
         If ReaderContiene("PEDV_Dir") Then e_ven_pedidos.PEDV_Dir = IIf(Not reader("PEDV_Dir") Is System.DBNull.Value, reader("PEDV_Dir"), Nothing)
         If ReaderContiene("PEDV_Tel") Then e_ven_pedidos.PEDV_Tel = IIf(Not reader("PEDV_Tel") Is System.DBNull.Value, reader("PEDV_Tel"), Nothing)
         If ReaderContiene("PEDV_Fax") Then e_ven_pedidos.PEDV_Fax = IIf(Not reader("PEDV_Fax") Is System.DBNull.Value, reader("PEDV_Fax"), Nothing)
         If ReaderContiene("PEDV_DiasVigencia") Then e_ven_pedidos.PEDV_DiasVigencia = IIf(Not reader("PEDV_DiasVigencia") Is System.DBNull.Value, reader("PEDV_DiasVigencia"), Nothing)
         If ReaderContiene("PEDV_HoraPedido") Then e_ven_pedidos.PEDV_HoraPedido = IIf(Not reader("PEDV_HoraPedido") Is System.DBNull.Value, reader("PEDV_HoraPedido"), Nothing)
         If ReaderContiene("PEDV_HoraSalReparto") Then e_ven_pedidos.PEDV_HoraSalReparto = IIf(Not reader("PEDV_HoraSalReparto") Is System.DBNull.Value, reader("PEDV_HoraSalReparto"), Nothing)
         If ReaderContiene("PEDV_HoraEntrega") Then e_ven_pedidos.PEDV_HoraEntrega = IIf(Not reader("PEDV_HoraEntrega") Is System.DBNull.Value, reader("PEDV_HoraEntrega"), Nothing)
         If ReaderContiene("PEDV_Salida") Then e_ven_pedidos.PEDV_Salida = IIf(Not reader("PEDV_Salida") Is System.DBNull.Value, reader("PEDV_Salida"), Nothing)
         If ReaderContiene("PEDV_Llegada") Then e_ven_pedidos.PEDV_Llegada = IIf(Not reader("PEDV_Llegada") Is System.DBNull.Value, reader("PEDV_Llegada"), Nothing)
         If ReaderContiene("LPRV_Codigo") Then e_ven_pedidos.LPRV_Codigo = IIf(Not reader("LPRV_Codigo") Is System.DBNull.Value, reader("LPRV_Codigo"), Nothing)
         If ReaderContiene("PEDV_Contacto") Then e_ven_pedidos.PEDV_Contacto = IIf(Not reader("PEDV_Contacto") Is System.DBNull.Value, reader("PEDV_Contacto"), Nothing)
         If ReaderContiene("PEDV_NumRef") Then e_ven_pedidos.PEDV_NumRef = IIf(Not reader("PEDV_NumRef") Is System.DBNull.Value, reader("PEDV_NumRef"), Nothing)
         If ReaderContiene("PEDV_ExonImp1") Then e_ven_pedidos.PEDV_ExonImp1 = IIf(Not reader("PEDV_ExonImp1") Is System.DBNull.Value, reader("PEDV_ExonImp1"), Nothing)
         If ReaderContiene("DIRE_Item") Then e_ven_pedidos.DIRE_Item = IIf(Not reader("DIRE_Item") Is System.DBNull.Value, reader("DIRE_Item"), Nothing)
         If ReaderContiene("ENTC_CodRepartidor") Then e_ven_pedidos.ENTC_CodRepartidor = IIf(Not reader("ENTC_CodRepartidor") Is System.DBNull.Value, reader("ENTC_CodRepartidor"), Nothing)
         If ReaderContiene("TIPE_Codigo") Then e_ven_pedidos.TIPE_Codigo = IIf(Not reader("TIPE_Codigo") Is System.DBNull.Value, reader("TIPE_Codigo"), Nothing)
         If ReaderContiene("ENTC_Codigo") Then e_ven_pedidos.ENTC_Codigo = IIf(Not reader("ENTC_Codigo") Is System.DBNull.Value, reader("ENTC_Codigo"), Nothing)
         If ReaderContiene("TIPE_CodRepartidor") Then e_ven_pedidos.TIPE_CodRepartidor = IIf(Not reader("TIPE_CodRepartidor") Is System.DBNull.Value, reader("TIPE_CodRepartidor"), Nothing)
         If ReaderContiene("TIPO_TabDocVenta") Then e_ven_pedidos.TIPO_TabDocVenta = IIf(Not reader("TIPO_TabDocVenta") Is System.DBNull.Value, reader("TIPO_TabDocVenta"), Nothing)
         If ReaderContiene("TIPO_CodDocVenta") Then e_ven_pedidos.TIPO_CodDocVenta = IIf(Not reader("TIPO_CodDocVenta") Is System.DBNull.Value, reader("TIPO_CodDocVenta"), Nothing)
         If ReaderContiene("TIPO_TabDocEntrega") Then e_ven_pedidos.TIPO_TabDocEntrega = IIf(Not reader("TIPO_TabDocEntrega") Is System.DBNull.Value, reader("TIPO_TabDocEntrega"), Nothing)
         If ReaderContiene("TIPO_CodDocEntrega") Then e_ven_pedidos.TIPO_CodDocEntrega = IIf(Not reader("TIPO_CodDocEntrega") Is System.DBNull.Value, reader("TIPO_CodDocEntrega"), Nothing)
         If ReaderContiene("PEDV_Tipo") Then e_ven_pedidos.PEDV_Tipo = IIf(Not reader("PEDV_Tipo") Is System.DBNull.Value, reader("PEDV_Tipo"), Nothing)
         If ReaderContiene("PEDV_Entrega") Then e_ven_pedidos.PEDV_Entrega = IIf(Not reader("PEDV_Entrega") Is System.DBNull.Value, reader("PEDV_Entrega"), Nothing)
         If ReaderContiene("PEDV_PorcDcto") Then e_ven_pedidos.PEDV_PorcDcto = IIf(Not reader("PEDV_PorcDcto") Is System.DBNull.Value, reader("PEDV_PorcDcto"), Nothing)
         If ReaderContiene("TIPE_CodTrans") Then e_ven_pedidos.TIPE_CodTrans = IIf(Not reader("TIPE_CodTrans") Is System.DBNull.Value, reader("TIPE_CodTrans"), Nothing)
         If ReaderContiene("ENTC_CodTrans") Then e_ven_pedidos.ENTC_CodTrans = IIf(Not reader("ENTC_CodTrans") Is System.DBNull.Value, reader("ENTC_CodTrans"), Nothing)
         If ReaderContiene("VEHI_Placa") Then e_ven_pedidos.VEHI_Placa = IIf(Not reader("VEHI_Placa") Is System.DBNull.Value, reader("VEHI_Placa"), Nothing)
         If ReaderContiene("PEDV_PagoParcial") Then e_ven_pedidos.PEDV_PagoParcial = IIf(Not reader("PEDV_PagoParcial") Is System.DBNull.Value, reader("PEDV_PagoParcial"), Nothing)
         If ReaderContiene("PVTA_Codigo") Then e_ven_pedidos.PVTA_Codigo = IIf(Not reader("PVTA_Codigo") Is System.DBNull.Value, reader("PVTA_Codigo"), Nothing)
         If ReaderContiene("rowguid") Then e_ven_pedidos.rowguid = IIf(Not reader("rowguid") Is System.DBNull.Value, reader("rowguid"), Nothing)
         If ReaderContiene("PEDV_UsrCrea") Then e_ven_pedidos.PEDV_UsrCrea = IIf(Not reader("PEDV_UsrCrea") Is System.DBNull.Value, reader("PEDV_UsrCrea"), Nothing)
         If ReaderContiene("PEDV_FecCrea") Then e_ven_pedidos.PEDV_FecCrea = IIf(Not reader("PEDV_FecCrea") Is System.DBNull.Value, reader("PEDV_FecCrea"), Nothing)
         If ReaderContiene("PEDV_UsrMod") Then e_ven_pedidos.PEDV_UsrMod = IIf(Not reader("PEDV_UsrMod") Is System.DBNull.Value, reader("PEDV_UsrMod"), Nothing)
         If ReaderContiene("PEDV_FecMod") Then e_ven_pedidos.PEDV_FecMod = IIf(Not reader("PEDV_FecMod") Is System.DBNull.Value, reader("PEDV_FecMod"), Nothing)
      Catch ex As Exception
         Throw ex
      End Try
   End Sub

   Public Shared Sub Cargar_Esquema(ByVal x_fila As DataRow, ByRef e_ven_pedidos As EVEN_Pedidos)
      Try
         If x_fila.Table.Columns.Contains("SUCR_Codigo") Then e_ven_pedidos.SUCR_Codigo = IIf(Not x_fila("SUCR_Codigo") Is System.DBNull.Value, x_fila("SUCR_Codigo"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_Numero") Then e_ven_pedidos.PEDV_Numero = IIf(Not x_fila("PEDV_Numero") Is System.DBNull.Value, x_fila("PEDV_Numero"), Nothing)
         If x_fila.Table.Columns.Contains("TIPO_TabDoc") Then e_ven_pedidos.TIPO_TabDoc = IIf(Not x_fila("TIPO_TabDoc") Is System.DBNull.Value, x_fila("TIPO_TabDoc"), Nothing)
         If x_fila.Table.Columns.Contains("TIPO_CodMotAnula") Then e_ven_pedidos.TIPO_CodMotAnula = IIf(Not x_fila("TIPO_CodMotAnula") Is System.DBNull.Value, x_fila("TIPO_CodMotAnula"), Nothing)
         If x_fila.Table.Columns.Contains("TIPO_TabMotAnula") Then e_ven_pedidos.TIPO_TabMotAnula = IIf(Not x_fila("TIPO_TabMotAnula") Is System.DBNull.Value, x_fila("TIPO_TabMotAnula"), Nothing)
         If x_fila.Table.Columns.Contains("TIPO_CodDoc") Then e_ven_pedidos.TIPO_CodDoc = IIf(Not x_fila("TIPO_CodDoc") Is System.DBNull.Value, x_fila("TIPO_CodDoc"), Nothing)
         If x_fila.Table.Columns.Contains("TIPO_CodFPG") Then e_ven_pedidos.TIPO_CodFPG = IIf(Not x_fila("TIPO_CodFPG") Is System.DBNull.Value, x_fila("TIPO_CodFPG"), Nothing)
         If x_fila.Table.Columns.Contains("TIPO_TabFPG") Then e_ven_pedidos.TIPO_TabFPG = IIf(Not x_fila("TIPO_TabFPG") Is System.DBNull.Value, x_fila("TIPO_TabFPG"), Nothing)
         If x_fila.Table.Columns.Contains("TIPO_TabMoneda") Then e_ven_pedidos.TIPO_TabMoneda = IIf(Not x_fila("TIPO_TabMoneda") Is System.DBNull.Value, x_fila("TIPO_TabMoneda"), Nothing)
         If x_fila.Table.Columns.Contains("TIPO_CodMoneda") Then e_ven_pedidos.TIPO_CodMoneda = IIf(Not x_fila("TIPO_CodMoneda") Is System.DBNull.Value, x_fila("TIPO_CodMoneda"), Nothing)
         If x_fila.Table.Columns.Contains("VEND_Codigo") Then e_ven_pedidos.VEND_Codigo = IIf(Not x_fila("VEND_Codigo") Is System.DBNull.Value, x_fila("VEND_Codigo"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_TipoCambio") Then e_ven_pedidos.PEDV_TipoCambio = IIf(Not x_fila("PEDV_TipoCambio") Is System.DBNull.Value, x_fila("PEDV_TipoCambio"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_FecEmi") Then e_ven_pedidos.PEDV_FecEmi = IIf(Not x_fila("PEDV_FecEmi") Is System.DBNull.Value, x_fila("PEDV_FecEmi"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_FecVcmto") Then e_ven_pedidos.PEDV_FecVcmto = IIf(Not x_fila("PEDV_FecVcmto") Is System.DBNull.Value, x_fila("PEDV_FecVcmto"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_PctjComiVen") Then e_ven_pedidos.PEDV_PctjComiVen = IIf(Not x_fila("PEDV_PctjComiVen") Is System.DBNull.Value, x_fila("PEDV_PctjComiVen"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_Estado") Then e_ven_pedidos.PEDV_Estado = IIf(Not x_fila("PEDV_Estado") Is System.DBNull.Value, x_fila("PEDV_Estado"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_Observaciones") Then e_ven_pedidos.PEDV_Observaciones = IIf(Not x_fila("PEDV_Observaciones") Is System.DBNull.Value, x_fila("PEDV_Observaciones"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_ValorTotalS") Then e_ven_pedidos.PEDV_ValorTotalS = IIf(Not x_fila("PEDV_ValorTotalS") Is System.DBNull.Value, x_fila("PEDV_ValorTotalS"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_ValorTotalD") Then e_ven_pedidos.PEDV_ValorTotalD = IIf(Not x_fila("PEDV_ValorTotalD") Is System.DBNull.Value, x_fila("PEDV_ValorTotalD"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_ValorVtaTotalS") Then e_ven_pedidos.PEDV_ValorVtaTotalS = IIf(Not x_fila("PEDV_ValorVtaTotalS") Is System.DBNull.Value, x_fila("PEDV_ValorVtaTotalS"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_ValorVtaTotalD") Then e_ven_pedidos.PEDV_ValorVtaTotalD = IIf(Not x_fila("PEDV_ValorVtaTotalD") Is System.DBNull.Value, x_fila("PEDV_ValorVtaTotalD"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_PrecVtaTotalS") Then e_ven_pedidos.PEDV_PrecVtaTotalS = IIf(Not x_fila("PEDV_PrecVtaTotalS") Is System.DBNull.Value, x_fila("PEDV_PrecVtaTotalS"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_PrecVtaTotalD") Then e_ven_pedidos.PEDV_PrecVtaTotalD = IIf(Not x_fila("PEDV_PrecVtaTotalD") Is System.DBNull.Value, x_fila("PEDV_PrecVtaTotalD"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_FleteTotalS") Then e_ven_pedidos.PEDV_FleteTotalS = IIf(Not x_fila("PEDV_FleteTotalS") Is System.DBNull.Value, x_fila("PEDV_FleteTotalS"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_FleteTotalD") Then e_ven_pedidos.PEDV_FleteTotalD = IIf(Not x_fila("PEDV_FleteTotalD") Is System.DBNull.Value, x_fila("PEDV_FleteTotalD"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_DctoTotalS") Then e_ven_pedidos.PEDV_DctoTotalS = IIf(Not x_fila("PEDV_DctoTotalS") Is System.DBNull.Value, x_fila("PEDV_DctoTotalS"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_DctoTotalD") Then e_ven_pedidos.PEDV_DctoTotalD = IIf(Not x_fila("PEDV_DctoTotalD") Is System.DBNull.Value, x_fila("PEDV_DctoTotalD"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_Imp1TotalS") Then e_ven_pedidos.PEDV_Imp1TotalS = IIf(Not x_fila("PEDV_Imp1TotalS") Is System.DBNull.Value, x_fila("PEDV_Imp1TotalS"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_Imp1TotalD") Then e_ven_pedidos.PEDV_Imp1TotalD = IIf(Not x_fila("PEDV_Imp1TotalD") Is System.DBNull.Value, x_fila("PEDV_Imp1TotalD"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_Imp2TotalS") Then e_ven_pedidos.PEDV_Imp2TotalS = IIf(Not x_fila("PEDV_Imp2TotalS") Is System.DBNull.Value, x_fila("PEDV_Imp2TotalS"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_Imp2TotalD") Then e_ven_pedidos.PEDV_Imp2TotalD = IIf(Not x_fila("PEDV_Imp2TotalD") Is System.DBNull.Value, x_fila("PEDV_Imp2TotalD"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_Imp3TotalS") Then e_ven_pedidos.PEDV_Imp3TotalS = IIf(Not x_fila("PEDV_Imp3TotalS") Is System.DBNull.Value, x_fila("PEDV_Imp3TotalS"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_Imp3TotalD") Then e_ven_pedidos.PEDV_Imp3TotalD = IIf(Not x_fila("PEDV_Imp3TotalD") Is System.DBNull.Value, x_fila("PEDV_Imp3TotalD"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_Imp4TotalS") Then e_ven_pedidos.PEDV_Imp4TotalS = IIf(Not x_fila("PEDV_Imp4TotalS") Is System.DBNull.Value, x_fila("PEDV_Imp4TotalS"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_Imp4TotalD") Then e_ven_pedidos.PEDV_Imp4TotalD = IIf(Not x_fila("PEDV_Imp4TotalD") Is System.DBNull.Value, x_fila("PEDV_Imp4TotalD"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_PorcImp1") Then e_ven_pedidos.PEDV_PorcImp1 = IIf(Not x_fila("PEDV_PorcImp1") Is System.DBNull.Value, x_fila("PEDV_PorcImp1"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_PorcImp2") Then e_ven_pedidos.PEDV_PorcImp2 = IIf(Not x_fila("PEDV_PorcImp2") Is System.DBNull.Value, x_fila("PEDV_PorcImp2"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_PorcImp3") Then e_ven_pedidos.PEDV_PorcImp3 = IIf(Not x_fila("PEDV_PorcImp3") Is System.DBNull.Value, x_fila("PEDV_PorcImp3"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_PorcImp4") Then e_ven_pedidos.PEDV_PorcImp4 = IIf(Not x_fila("PEDV_PorcImp4") Is System.DBNull.Value, x_fila("PEDV_PorcImp4"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_NumDoc") Then e_ven_pedidos.PEDV_NumDoc = IIf(Not x_fila("PEDV_NumDoc") Is System.DBNull.Value, x_fila("PEDV_NumDoc"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_SerieDoc") Then e_ven_pedidos.PEDV_SerieDoc = IIf(Not x_fila("PEDV_SerieDoc") Is System.DBNull.Value, x_fila("PEDV_SerieDoc"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_RazonSoc") Then e_ven_pedidos.PEDV_RazonSoc = IIf(Not x_fila("PEDV_RazonSoc") Is System.DBNull.Value, x_fila("PEDV_RazonSoc"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_Ruc") Then e_ven_pedidos.PEDV_Ruc = IIf(Not x_fila("PEDV_Ruc") Is System.DBNull.Value, x_fila("PEDV_Ruc"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_Dir") Then e_ven_pedidos.PEDV_Dir = IIf(Not x_fila("PEDV_Dir") Is System.DBNull.Value, x_fila("PEDV_Dir"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_Tel") Then e_ven_pedidos.PEDV_Tel = IIf(Not x_fila("PEDV_Tel") Is System.DBNull.Value, x_fila("PEDV_Tel"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_Fax") Then e_ven_pedidos.PEDV_Fax = IIf(Not x_fila("PEDV_Fax") Is System.DBNull.Value, x_fila("PEDV_Fax"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_DiasVigencia") Then e_ven_pedidos.PEDV_DiasVigencia = IIf(Not x_fila("PEDV_DiasVigencia") Is System.DBNull.Value, x_fila("PEDV_DiasVigencia"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_HoraPedido") Then e_ven_pedidos.PEDV_HoraPedido = IIf(Not x_fila("PEDV_HoraPedido") Is System.DBNull.Value, x_fila("PEDV_HoraPedido"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_HoraSalReparto") Then e_ven_pedidos.PEDV_HoraSalReparto = IIf(Not x_fila("PEDV_HoraSalReparto") Is System.DBNull.Value, x_fila("PEDV_HoraSalReparto"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_HoraEntrega") Then e_ven_pedidos.PEDV_HoraEntrega = IIf(Not x_fila("PEDV_HoraEntrega") Is System.DBNull.Value, x_fila("PEDV_HoraEntrega"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_Salida") Then e_ven_pedidos.PEDV_Salida = IIf(Not x_fila("PEDV_Salida") Is System.DBNull.Value, x_fila("PEDV_Salida"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_Llegada") Then e_ven_pedidos.PEDV_Llegada = IIf(Not x_fila("PEDV_Llegada") Is System.DBNull.Value, x_fila("PEDV_Llegada"), Nothing)
         If x_fila.Table.Columns.Contains("LPRV_Codigo") Then e_ven_pedidos.LPRV_Codigo = IIf(Not x_fila("LPRV_Codigo") Is System.DBNull.Value, x_fila("LPRV_Codigo"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_Contacto") Then e_ven_pedidos.PEDV_Contacto = IIf(Not x_fila("PEDV_Contacto") Is System.DBNull.Value, x_fila("PEDV_Contacto"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_NumRef") Then e_ven_pedidos.PEDV_NumRef = IIf(Not x_fila("PEDV_NumRef") Is System.DBNull.Value, x_fila("PEDV_NumRef"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_ExonImp1") Then e_ven_pedidos.PEDV_ExonImp1 = IIf(Not x_fila("PEDV_ExonImp1") Is System.DBNull.Value, x_fila("PEDV_ExonImp1"), Nothing)
         If x_fila.Table.Columns.Contains("DIRE_Item") Then e_ven_pedidos.DIRE_Item = IIf(Not x_fila("DIRE_Item") Is System.DBNull.Value, x_fila("DIRE_Item"), Nothing)
         If x_fila.Table.Columns.Contains("ENTC_CodRepartidor") Then e_ven_pedidos.ENTC_CodRepartidor = IIf(Not x_fila("ENTC_CodRepartidor") Is System.DBNull.Value, x_fila("ENTC_CodRepartidor"), Nothing)
         If x_fila.Table.Columns.Contains("TIPE_Codigo") Then e_ven_pedidos.TIPE_Codigo = IIf(Not x_fila("TIPE_Codigo") Is System.DBNull.Value, x_fila("TIPE_Codigo"), Nothing)
         If x_fila.Table.Columns.Contains("ENTC_Codigo") Then e_ven_pedidos.ENTC_Codigo = IIf(Not x_fila("ENTC_Codigo") Is System.DBNull.Value, x_fila("ENTC_Codigo"), Nothing)
         If x_fila.Table.Columns.Contains("TIPE_CodRepartidor") Then e_ven_pedidos.TIPE_CodRepartidor = IIf(Not x_fila("TIPE_CodRepartidor") Is System.DBNull.Value, x_fila("TIPE_CodRepartidor"), Nothing)
         If x_fila.Table.Columns.Contains("TIPO_TabDocVenta") Then e_ven_pedidos.TIPO_TabDocVenta = IIf(Not x_fila("TIPO_TabDocVenta") Is System.DBNull.Value, x_fila("TIPO_TabDocVenta"), Nothing)
         If x_fila.Table.Columns.Contains("TIPO_CodDocVenta") Then e_ven_pedidos.TIPO_CodDocVenta = IIf(Not x_fila("TIPO_CodDocVenta") Is System.DBNull.Value, x_fila("TIPO_CodDocVenta"), Nothing)
         If x_fila.Table.Columns.Contains("TIPO_TabDocEntrega") Then e_ven_pedidos.TIPO_TabDocEntrega = IIf(Not x_fila("TIPO_TabDocEntrega") Is System.DBNull.Value, x_fila("TIPO_TabDocEntrega"), Nothing)
         If x_fila.Table.Columns.Contains("TIPO_CodDocEntrega") Then e_ven_pedidos.TIPO_CodDocEntrega = IIf(Not x_fila("TIPO_CodDocEntrega") Is System.DBNull.Value, x_fila("TIPO_CodDocEntrega"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_Tipo") Then e_ven_pedidos.PEDV_Tipo = IIf(Not x_fila("PEDV_Tipo") Is System.DBNull.Value, x_fila("PEDV_Tipo"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_Entrega") Then e_ven_pedidos.PEDV_Entrega = IIf(Not x_fila("PEDV_Entrega") Is System.DBNull.Value, x_fila("PEDV_Entrega"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_PorcDcto") Then e_ven_pedidos.PEDV_PorcDcto = IIf(Not x_fila("PEDV_PorcDcto") Is System.DBNull.Value, x_fila("PEDV_PorcDcto"), Nothing)
         If x_fila.Table.Columns.Contains("TIPE_CodTrans") Then e_ven_pedidos.TIPE_CodTrans = IIf(Not x_fila("TIPE_CodTrans") Is System.DBNull.Value, x_fila("TIPE_CodTrans"), Nothing)
         If x_fila.Table.Columns.Contains("ENTC_CodTrans") Then e_ven_pedidos.ENTC_CodTrans = IIf(Not x_fila("ENTC_CodTrans") Is System.DBNull.Value, x_fila("ENTC_CodTrans"), Nothing)
         If x_fila.Table.Columns.Contains("VEHI_Placa") Then e_ven_pedidos.VEHI_Placa = IIf(Not x_fila("VEHI_Placa") Is System.DBNull.Value, x_fila("VEHI_Placa"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_PagoParcial") Then e_ven_pedidos.PEDV_PagoParcial = IIf(Not x_fila("PEDV_PagoParcial") Is System.DBNull.Value, x_fila("PEDV_PagoParcial"), Nothing)
         If x_fila.Table.Columns.Contains("PVTA_Codigo") Then e_ven_pedidos.PVTA_Codigo = IIf(Not x_fila("PVTA_Codigo") Is System.DBNull.Value, x_fila("PVTA_Codigo"), Nothing)
         If x_fila.Table.Columns.Contains("rowguid") Then e_ven_pedidos.rowguid = IIf(Not x_fila("rowguid") Is System.DBNull.Value, x_fila("rowguid"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_UsrCrea") Then e_ven_pedidos.PEDV_UsrCrea = IIf(Not x_fila("PEDV_UsrCrea") Is System.DBNull.Value, x_fila("PEDV_UsrCrea"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_FecCrea") Then e_ven_pedidos.PEDV_FecCrea = IIf(Not x_fila("PEDV_FecCrea") Is System.DBNull.Value, x_fila("PEDV_FecCrea"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_UsrMod") Then e_ven_pedidos.PEDV_UsrMod = IIf(Not x_fila("PEDV_UsrMod") Is System.DBNull.Value, x_fila("PEDV_UsrMod"), Nothing)
         If x_fila.Table.Columns.Contains("PEDV_FecMod") Then e_ven_pedidos.PEDV_FecMod = IIf(Not x_fila("PEDV_FecMod") Is System.DBNull.Value, x_fila("PEDV_FecMod"), Nothing)
      Catch ex As Exception
         Throw ex
      End Try
   End Sub
#End Region

#Region " Metodos Interfaces "
   Public Function Clone() As Object Implements System.ICloneable.Clone
      Try
         Dim cloneInstance As New EVEN_Pedidos()
         cloneInstance = DirectCast(Me, EVEN_Pedidos)
         Return cloneInstance.MemberwiseClone
      Catch ex As Exception
         Throw ex
      End Try
   End Function
#End Region
   
End Class